const path = require("path");
const resolve = (dir) => {
  return path.join(__dirname, dir);
};
module.exports = {
  devServer: {
    port: 8686,
    open: true,
    // host: '47.93.21.7:8889',
    proxy: {
      "/common": {
        target: `http://82.156.242.30:8889`,
        changeOrigin: true,
        pathRewrite: {
          "^/": "", //请求的时候使用这个api就可以
        },
      },
    },
  },
  chainWebpack: (config) => {
    config.resolve.alias
      // 公共模块地址映射
      .set("@", resolve("src"))
      .set("_my", resolve("my-common"))
      .set("_my_c", resolve("my-common/components"))
      .set("_my_router", resolve("my-common/router"))
      .set("_my_api", resolve("my-common/api"))
      .set("_my_view", resolve("my-common/view"))
      .set("_my_utils", resolve("my-common/utils"));
  },
  pluginOptions: {
    "style-resources-loader": {
      preProcessor: "less",
      patterns: [
        path.resolve(__dirname, "./my-common/assets/less/global.less"),
      ],
    },
  },
};
